gtk_entry_completion_set_match_func
gtk_entry_completion_set_minimum_key_length
gtk_entry_completion_get_minimum_key_length
+gtk_entry_completion_compute_prefix
gtk_entry_completion_complete
gtk_entry_completion_get_completion_prefix
gtk_entry_completion_insert_prefix
gtk_entry_buffer_set_max_length
gtk_entry_buffer_set_text
gtk_entry_completion_complete
+gtk_entry_completion_compute_prefix
gtk_entry_completion_delete_action
gtk_entry_completion_get_completion_prefix
gtk_entry_completion_get_entry
return TRUE;
}
-static gchar *
-gtk_entry_completion_compute_prefix (GtkEntryCompletion *completion)
+/**
+ * gtk_entry_completion_compute_prefix:
+ * @completion: the entry completion
+ * @key: The text to complete for
+ *
+ * Computes the common prefix that is shared by all rows in @completion
+ * that start with @key. If no row matches @key, %NULL will be returned.
+ * Note that a text column must have been set for this function to work,
+ * see gtk_entry_completion_set_text_column() for details.
+ *
+ * Returns: (transfer: full): The common prefix all rows starting with @key
+ * or %NULL if no row matches @key.
+ *
+ * Since: 3.4
+ **/
+gchar *
+gtk_entry_completion_compute_prefix (GtkEntryCompletion *completion,
+ const char *key)
{
GtkTreeIter iter;
gchar *prefix = NULL;
gboolean valid;
- const gchar *key;
if (completion->priv->text_column < 0)
return NULL;
- key = gtk_entry_get_text (GTK_ENTRY (completion->priv->entry));
-
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (completion->priv->filter_model),
&iter);
g_signal_handler_block (completion->priv->entry,
completion->priv->insert_text_id);
- prefix = gtk_entry_completion_compute_prefix (completion);
+ prefix = gtk_entry_completion_compute_prefix (completion,
+ gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)));
+
if (prefix)
{
g_signal_emit (completion, entry_completion_signals[INSERT_PREFIX],
void gtk_entry_completion_set_minimum_key_length (GtkEntryCompletion *completion,
gint length);
gint gtk_entry_completion_get_minimum_key_length (GtkEntryCompletion *completion);
+gchar * gtk_entry_completion_compute_prefix (GtkEntryCompletion *completion,
+ const char *key);
void gtk_entry_completion_complete (GtkEntryCompletion *completion);
void gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion);